package com.project.gateway.log;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class GatewayLog {
    /**请求来源**/
    private String origin;

    /**访问实例*/
    private String targetServer;

    /**请求路径*/
    private String requestPath;

    /**请求方法*/
    private String requestMethod;

    /**协议 */
    private String schema;

    /**请求类型 */
    private String requestContentType;

    /**请求头 */
    private String headers;

    /**请求体*/
    private String requestBody;

    /**响应体*/
    private String responseData;

    /**请求ip*/
    private String ip;


    /**请求时间*/
    private long requestTime;

    /**响应时间*/
    private long responseTime;

    /**执行时间*/
    private long executeTime;

    /**路由配置*/
    private String routeConfig;

    /**响应状态*/
    private String responseState;


    @Override
    public String toString() {
        return "GatewayLog{" +
                "origin='" + origin + '\'' +
                ", targetServer='" + targetServer + '\'' +
                ", requestPath='" + requestPath + '\'' +
                ", requestMethod='" + requestMethod + '\'' +
                ", schema='" + schema + '\'' +
                ", requestContentType='" + requestContentType + '\'' +
                ", headers='" + headers + '\'' +
                ", requestBody='" + requestBody + '\'' +
                ", responseData='" + responseData + '\'' +
                ", ip='" + ip + '\'' +
                ", requestTime='" + new Date(requestTime) + '\'' +
                ", responseTime='" + new Date(responseTime) + '\'' +
                ", executeTime=" + executeTime/1000 +
                ", routeConfig='" + routeConfig + '\'' +
                ", responseState='" + responseState + '\'' +
                '}';
    }
}


